package tt.dz.egobus.servicemanager.service.impl;

import tt.dz.egobus.base.context.SpringApplicationHolder;
import tt.dz.egobus.cache.service.ExtendCacheService;
import tt.dz.egobus.servicemanager.business.point.Point;
import tt.dz.egobus.servicemanager.business.point.TransferPoint;

/**
 * @author Anson
 * @date 17-3-29
 * @name
 * @since 1.0.3
 */
public class RedisCacheTransferPoint implements TransferPoint {


    private boolean isStoreBusinessStatusPoint;

    private ExtendCacheService extendCacheService;

    public RedisCacheTransferPoint() {

    }


    @Override
    public Point[] getPoints(String driverId) {
        this.setCacheContext();
        return new Point[0];
    }


    @Override
    public boolean uploadPoint(String driverId, Point point) {
        this.setCacheContext();
        return false;
    }

    private void setCacheContext() {
        if (this.extendCacheService == null) {
            this.extendCacheService = this.getExtendCacheService();
        }
    }

    private ExtendCacheService getExtendCacheService() {
        return SpringApplicationHolder.getBean("extendsRedisServiceImpl", ExtendCacheService.class);
    }
}
